Caveats
Assertions
-
"For performance reasons, the code inside assert is only executed in debug builds or when running the project from the editor. Don't include code that has side effects in an assert call. Otherwise, the project will behave differently when exported in release mode."
-
Source .
-
CMD Line Arguments
OS.get_cmdline_args()
-
.
OS.get_cmdline_user_args()
-
Returns the command-line user arguments passed to the engine. User arguments are ignored by the engine and reserved for the user. They are passed after the double dash -- argument. ++ may be used when -- is intercepted by another program (such as startx).
# Godot has been executed with the following command:
# godot --fullscreen -- --level=2 --hardcore
OS.get_cmdline_args() # Returns ["--fullscreen", "--level=2", "--hardcore"]
OS.get_cmdline_user_args() # Returns ["--level=2", "--hardcore"]
In summary:
-
.\game-v1-1.exe --s1|.\game-v1-1.console.exe --s1-
OS.get_cmdline_args():-
identifies
--s1
-
-
OS.get_cmdline_user_args():-
Does not identify
--s1
-
-
-
.\game-v1-1.exe -- --s1|.\game-v1-1.console.exe --s1-
OS.get_cmdline_args():-
Does not identify
--s1
-
-
OS.get_cmdline_user_args():-
identifies
--s1
-
-
Feature Flags
-
List .
-
OS.has_feature('name'). -
OS.has_feature('debug'): -
OS.is_debug_build():-
.
-
-
.
-
Result:
-
file.exe-
is_debug -> true
-
-
file.console.exe-
is_debug -> true
-
-
-
Platforms
Android
-
Android .
Steam
-
Steam .
iOS
-
iOS .